﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using AmazonGlacierGUI.UI.Infrastructure.MVVMFramework;
using AmazonGlacierGUI.UI.ViewModels;

namespace AmazonGlacierGUI.UI.Views
{
    /// <summary>
    /// Interaction logic for ArchiveSelectSourceView.xaml
    /// </summary>
    public partial class ArchiveSelectSourceView : Window
    {
        private ArchiveSelectSourceViewModel _vm;
        public ArchiveSelectSourceView()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(ArchiveSelectSourceView_Loaded);
        }

        void ArchiveSelectSourceView_Loaded(object sender, RoutedEventArgs e)
        {
            _vm = new ArchiveSelectSourceViewModel();
            Framework.BindViewModel(this,_vm);
        }

        private void ArchiveSelectSourceButton_Click(object sender, RoutedEventArgs e)
        {
            if(e.OriginalSource==ArchiveSelectSourceButtonHistory)
            {
                _vm.SelectSource(ArchiveSelectSourceViewModel.SourceTypeEnum.History);
            }
            else if (e.OriginalSource == ArchiveSelectSourceButtonInventory)
            {
                _vm.SelectSource(ArchiveSelectSourceViewModel.SourceTypeEnum.Inventory);
            }
            else if (e.OriginalSource == ArchiveSelectSourceButtonArchiveId)
            {
                _vm.SelectSource(ArchiveSelectSourceViewModel.SourceTypeEnum.ArchiveId);
            }
        }
    }
}
